import QtQuick 1.0


Item {
    id:main
    property int sensibility: 100
    property int posx;
    property int posy;
    property int directionx;
    property int directiony;
    signal swipe(int x, int y)
    signal left()
    signal right()
    signal top()
    signal bottom()


    //    property point direction;



    MouseArea {

        anchors.fill: parent
        onPressed: {
            posx = mouse.x;
            posy = mouse.y;
        }
        onReleased: {
            directionx = mouse.x - main.posx;
            directiony = mouse.y - main.posy;
            main.swipe(directionx,directiony)

            if ( directionx > sensibility)
                main.right();
            if ( directionx < -sensibility)
                main.left();

            if ( directiony > sensibility)
                main.bottom();
            if ( directiony < -sensibility)
                main.top();
        }


    }

}
